package com.yanqu.road.utils;

import com.yanqu.road.utils.string.StringUtils;

import java.io.UnsupportedEncodingException;
import java.net.URLEncoder;

public class MyURLEncoderHelper {

    public static String encode(String content, String enc) throws UnsupportedEncodingException {
        if(StringUtils.isNullOrEmpty(content)){
            return "";
        }
        String value = URLEncoder.encode(content, enc);
        value = value.replaceAll("\\+", "%20");
        return value;
    }
}
